<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body,p{margin: 0;}
        .top,.bottom{height: 30px;}
        .middle{overflow: hidden;}
    
        .mainWrap{
            width: 100%;
            float: left;
        }
        .main{
            margin: 0 120px;/*20px间距*/
        }
        .left,.right{
            float:left;
            width: 100px;
        }
        .left{
            margin-left: -100%;
        }
        .right{
            margin-left: -100px;
        }

    </style>
</head>

<body>
    <div class="parent" id="parent">
        <div class="top" style="background-color: green;">
            <p>top</p>
        </div>
        <div class="middle" style="background-color: red;">
            <div class="mainWrap">
                <div class="main" style="background-color: #fff;">
                    <p>main</p>
                    <p>main</p>
                </div>
            </div>
            <div class="left" style="background-color: yellow;">
                <p>left</p>
            </div>
            <div class="right" style="background-color: yellow;">
                <p>right</p>
            </div>
        </div>
        <div class="bottom" style="background-color: black;">
            <p>bottom</p>
        </div>
    </div>
</body>

</html>